﻿using TopHero;
using UnityEngine;

public class GameController : MonoBehaviour
{
    public float timeScale = 1;

    private static GameController _instance;

    public static GameController Instance => _instance;
    
    private Game _game;

    void Start()
    {
        _instance = this;
        _game = new Game(new UnityTimeService(), new UnityViewService(), new UnityDebugService());
    }

    void Update()
    {
        _game.SetTimeScale(timeScale);
        _game.Update();
    }

    private void OnDestroy()
    {
        _game.Destroy();
    }

    public Game game => _game;
}